//
//  YQMeHeadView.m
//  NewRetail
//
//  Created by yuqin on 2019/6/24.
//  Copyright © 2019 yuqin. All rights reserved.
//

#import "YQMeHeadView.h"

@interface YQMeHeadView()

@property (nonatomic, strong) UIView *backView;

@end

@implementation YQMeHeadView

- (void)setupContentView {
    //应该是渐变的image 暂时先设置背景
    [self addSubview:self.backView];
    [self.backView addSubview:self.bgImg];
    [self.backView addSubview:self.coinImg];
    [self.backView addSubview:self.shareFriendLab];
    [self.backView addSubview:self.shareBtn];
    
    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0));
    }];
    
    [self.bgImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0));
    }];
    
    [self.coinImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.backView.mas_centerY);
        make.left.mas_equalTo(FIT(20));
        make.size.mas_equalTo(CGSizeMake(FIT(35), FIT(35)));
    }];
    
    [self.shareFriendLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.coinImg.mas_right).mas_equalTo(FIT(20));
        make.centerY.mas_equalTo(self.backView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(FIT(200), FIT(20)));
    }];
    
    [self.shareBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-kMargin_right);
        make.centerY.mas_equalTo(self.backView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(FIT(80), FIT(35)));
    }];
}

- (UIView *)backView {
    if (!_backView) {
        _backView = [[UIView alloc] init];
        _backView.backgroundColor = [UIColor clearColor];
        _backView.layer.cornerRadius = 10;
        _backView.layer.masksToBounds = YES;
    }
    return _backView;
}

- (UIImageView *)bgImg {
    if (!_bgImg) {
        _bgImg = [YQViewFactory imageViewWithImage:YQ_IMAGE(@"")];
        _bgImg.backgroundColor = UIColorFromRGB(0x7098e5);
    }
    return _bgImg;
}

- (UIImageView *)coinImg {
    if (!_coinImg) {
        _coinImg = [YQViewFactory imageViewWithImage:YQ_IMAGE(@"")];
        _coinImg.layer.cornerRadius = FIT(35)/2.0;
        _coinImg.layer.masksToBounds = YES;
    }
    return _coinImg;
}

- (UILabel *)shareFriendLab {
    if (!_shareFriendLab) {
        _shareFriendLab = [YQViewFactory labelWithTextColor:WhiteColor textAlignment:NSTextAlignmentLeft fontSize:kTheTitleFont userBold:NO];
        _shareFriendLab.text = @"分享WDC Wallet给好友";
    }
    return _shareFriendLab;
}

- (UIButton *)shareBtn {
    if (!_shareBtn) {
        _shareBtn = [YQViewFactory buttonWithTitle:@"立即分享" titleColor:WhiteColor fontSize:kNormalButtonFont userBold:NO target:self sel:@selector(shareAction)];
        _shareBtn.backgroundColor = UIColorFromRGB(0x7098e5);
        _shareBtn.layer.cornerRadius = 5;
        _shareBtn.layer.borderWidth = 1;
        _shareBtn.layer.borderColor = WhiteColor.CGColor;
    }
    return _shareBtn;
}

#pragma mark - 分享
- (void)shareAction {
    
}

@end
